Software programs often require executing various operations that execute at different speeds or use different amounts of computer resources. Moreover, in some programs, one set of operations use the results of another set of operations. In some cases, a program performs a set of iterative operations and repeatedly outputs the results of the iterations to another operation. For example, some programs execute a set of calculations in a repetitive loop and the results of those calculations are iteratively used by a set of drawing operations which refreshes a drawing of those results. Some other programs can feed the results of the iterative calculations to an output program to, for example, display or print the results. A high level example of such an iterative program is shown in code (1).
Code (1)
data=initialize_data( );
for i=1, loop_count
                % perform calculations here        updated_data=calculate(data);        % perform drawing here        draw(updated_data);        
data=updated_data;
end
In code (1), after initiating data, a loop runs over the index i. In each iteration of the loop, a calculate( ) function calculates some updated data and a draw( ) function draws the updated data. Code (1), in particular, satisfies sequential locality of reference for updated_data, in that the draw( ) function always uses updated_data after the calculate( ) function has completed calculating the updated_date. Therefore, the state of the updated_data, when used by draw( ) is predictable.
Various operations may run at different speeds and the user may not need to apply the results of a first operation to a second operation in every iteration. For example, in code (1), in each iteration the calculation operation calculate( ) may only take a few microseconds to update the data, but the draw( ) operation may take a few seconds to draw the updated data on a screen. Moreover, the user may only need to draw the results once every ten seconds and not for every updated calculation. Thus, including all operations in a loop and without any constraints on when each operation should be executed, as in the example of code (1), may slow down the faster operations, here the calculations, for the sake of unnecessarily running in each iteration the slower operation, here drawing the updated data. On the other hand, the user may still need to repeat the slower operation, here the drawing, albeit not as often as the calculations.